home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / ffactwin.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  1.8 KB  |  51 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "FFactWin.h"
  10. #include <stdio.h>
  11. //---------------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TForm1 *Form1;
  14. //---------------------------------------------------------------------------
  15. __fastcall TForm1::TForm1(TComponent* Owner)
  16.   : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20.  
  21. // This application shows how to display Paradox style memo and graphic
  22. // fields in a form. Table1's DatabaseName property should point to the
  23. // Borland sample database. Table1's TableName property should be set to 
  24. // the BIOLIFE table.
  25. //
  26.  
  27. void __fastcall TForm1::SaveClick(TObject *Sender)
  28. {
  29.     FILE *outfile;
  30.     char buff[100];
  31.  
  32.     sprintf(buff, "Save Info For: %s", DBLabel1->Field->AsString.c_str());
  33.     SaveDialog1->Title = buff;
  34.  
  35.     if (SaveDialog1->Execute())
  36.     {
  37.         outfile = fopen(SaveDialog1->FileName.c_str(), "wt");
  38.         if (outfile)
  39.         {
  40.             fprintf(outfile, "Facts on the %s\n\n", (LPSTR)DBLabel1->Field->AsString.c_str());
  41.             for (int i=0; i < DBGrid1->FieldCount; i++)
  42.                  fprintf(outfile, "%s: %s\n",
  43.                     (LPSTR)DBGrid1->Fields[i]->FieldName.c_str(),
  44.                     (LPSTR)DBGrid1->Fields[i]->AsString.c_str());
  45.             fprintf(outfile, "\n%s\n", (LPSTR)DBMemo1->Text.c_str());
  46.         }
  47.         fclose(outfile);
  48.     }
  49. }
  50. //---------------------------------------------------------------------
  51.